import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render, formatTimestamp } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '城市',
		align: "center",
		dataIndex: 'cityid_dictText'
	},
	{
		title: '头像',
		align: "center",
		dataIndex: 'avatar',
		customRender: render.renderImage
	},
	{
		title: '名称',
		align: "center",
		dataIndex: 'name'
	},
	{
		title: '接待人员id',
		align: "center",
		dataIndex: 'receptions'
	},
	{
		title: '添加时间',
		align: "center",
		dataIndex: 'createtime',
		customRender: ({ text }) => {

			return formatTimestamp(text)
		}
	},
	{
		title: '上一次修改时间',
		align: "center",
		dataIndex: 'updatetime',
		customRender: ({ text }) => {
			return formatTimestamp(text)
		}
	},
	/* {
		title: '状态',
		align: "center",
		dataIndex: 'stats',
		customRender: ({ text }) => {
			if(text)return '是'
			if(!text)return '否'

		}
	}, */
	{
		title: '管理权限',
		align: "center",
		dataIndex: 'manageprivilege',
		customRender: ({ text }) => {
			if (text) return '有'
			if (!text) return '无'
		}
	},

	{
		title: '客服id',
		align: "center",
		dataIndex: 'openkfid'
	},
	
/* 	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantid'
	}, */
	/* {
		title: '工作人员',
		align: "center",
		dataIndex: 'workid'
	}, */
];
//查询数据
export const searchFormSchema : FormSchema[] = [
];
//表单数据
export const receptionsFrom : FormSchema[] = [
	{
		label: '接待人员(逗号分割)',
		field: 'receptions',
		component: 'Input',
		required:true
	},
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
	{
		label: '',
		field: 'openkfid',
		component: 'Input',
		show: false
	},
]
export const formSchema : FormSchema[] = [
	/* {
		label: 'createtime',
		field: 'createtime',
		component: 'InputNumber',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入createtime!' },
			];
		},
	}, */
	/* 	{
			label: '状态',
			field: 'stats',
			component: 'Input',
			dynamicRules: ({ model, schema }) => {
				return [
					{ required: true, message: '请输入状态!' },
				];
			},
		}, */
	/* 	{
			label: '管理权限',
			field: 'manageprivilege',
			component: 'Input',
			dynamicRules: ({ model, schema }) => {
				return [
					{ required: true, message: '请输入管理权限!' },
				];
			},
		}, */
	{
		label: '头像',
		field: 'avatar',
		component: 'Input',
		slot: "uploadAvatarSlot",
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请上传头像!' },
			];
		},
	},
	{
		label: '名称',
		field: 'name',
		component: 'Input',
	},
	{
		label: 'id',
		field: 'openkfid',
		component: 'Input',
		show: false
	},
	/* {
		label: '修改时间',
		field: 'updatetime',
		component: 'InputNumber',
	}, */
	{
		label: '城市',
		field: 'cityid',
		component: 'JSelectMultiple',
		componentProps: {
			dictCode: 'Bs_CityExpandInfo,name,cityid'
		}
	},
	/* 	{
			label: '租户id',
			field: 'tenantid',
			component: 'InputNumber',
		}, */
	/* 	{
			label: '工作人员',
			field: 'workid',
			component: 'Input',
		}, */
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
	{
		label: '',
		field: 'extinfor',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}